<script setup lang="ts">
import { usePipelineInfoStore } from '@/store/modules/earlyWarning/pipelineInfo';

const { pipelineInfoData } = storeToRefs(usePipelineInfoStore());
const { togglePipeLineEntities } = usePipelineInfoStore();
</script>

<template>
  <el-row :gutter="20" class="pipe-box">
    <el-col :span="12" v-for="(item, index) in pipelineInfoData" :key="item.id">
      <div class="pipe-item-box" :class="[index === pipelineInfoData.length - 1 && 'last-child']" @click="togglePipeLineEntities(item)">
        <div :class="['pipe-item-icon-box', item.clickStatus && 'active']">{{ item.value }}</div>
        <div class="pipe-item-text-box">{{ item.name }}</div>
      </div>
    </el-col>
  </el-row>
</template>

<style scoped lang="scss">
.pipe-box {
  width: 100%;
  height: 100%;
}

.pipe-item-box {
  flex: 0 0 20%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.1rem; // 添加一些内边距
  margin-bottom: 14px;
  cursor: pointer;
  color: white;

  .pipe-item-icon-box {
    width: 8.25rem;
    height: 4.6056rem;
    text-align: center;
    line-height: 1.875rem;
    background: url(@/assets/largescreen/pipe-pic.png) no-repeat center center;
    background-size: 100% 100%;
    font-size: 1.25rem;
    font-family: YouSheYaHei;
    font-weight: 700;
  }

  .pipe-item-text-box {
    margin-top: 0.1rem; // 文字和图标之间的间距
  }

  .active {
    background: url(@/assets/largescreen/Selected-pipLine.png) no-repeat center center;
    background-size: 70% 70%;
  }
}

.last-child {
  cursor: default;
}
</style>
